home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 8
/
The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO
/
prg_casm
/
snpd9611.zip
/
BRESNHAM.C
< prev
next >
Wrap
Text File
|
1996-11-24
|
892b
|
34 lines
.I 0 2
/* +++Date last modified: 27-Oct-1996 */
.I 4 2
** Circle algorithm and other stuff rewritten by Kurt Kuzba
**
.I 52 3
steep = x; x = y; y = steep; /* swap x and y */
steep = dx; dx = dy; dy = steep; /* swap dx and dy */
steep = sx; sx = sy; sy = steep; /* swap sx and sy */
.D 54 9
.I 65 1
for(i = 0; i < dx; i++)
.D 66 1
.I 90 12
int x = 0, d = 2 * (1 - r), w = 2 * SCREEN_WIDTH / SCREEN_HEIGHT;
while(r >= 0)
{
plotdot(xc + x, yc + r, c);
plotdot(xc + x, yc - r, c);
plotdot(xc - x, yc + r, c);
plotdot(xc - x, yc - r, c);
if (d + r > 0)
d -= (w * --r) - 1;
if (x > d)
d += (2 * ++x) + 1;
.D 91 18
.I 113 3
#ifndef __TURBOC__
#include "bc_rand.h"
#endif
.D 114 1